package com.away.fuckingworld.entity.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultVO<T> extends BaseResult{
    private T data;

    public ResultVO(Integer code, String message, T data) {
        super(code, message);
        this.data = data;
    }
    public ResultVO(String code, String message){
        super(code, message);
    }

    public ResultVO(Integer code, String message){
        super(code, message);
    }


    public static <T> ResultVO<T> success(T data) {
        return new ResultVO(CODE_SUCCESS, "", data);
    }

    public static <T> ResultVO<T> error(Integer errorCode,String msg) {
        return new ResultVO<>(errorCode, msg);
    }

    public static <T> ResultVO<T> error(String errorCode,String msg) {
        return new ResultVO<>(errorCode, msg);
    }
}
